//
//  WXPAuthBankCardFooterView.m
//  MexicoLoan
//
//  Created by wxp on 2025/3/3.
//

#import "WXPAuthBankCardFooterView.h"

@implementation WXPAuthBankCardFooterView

#pragma mark - lazy
- (UIView *)viewContent{
    if (!_viewContent) {
        _viewContent = [UIView new];
        _viewContent.backgroundColor = COLOR_WHITE;
        _viewContent.width = SCREEN_WIDTH-LEFT_MARDIN*2;
    }
    return _viewContent;
}
- (UILabel *)labelContent{
    if (!_labelContent) {
        _labelContent = [UILabel new];
        _labelContent.fontNum = 12;
        _labelContent.textColor = COLOR_RED;
        _labelContent.numberOfLines = 0;
        _labelContent.lineSpace = 3;
        [_labelContent fitTitle:@"El número de la cuenta bancaria no es el correcto" variable:self.viewContent.width-2*LEFT_MARDIN];
    }
    return _labelContent;
}

#pragma mark - 初始化
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        self.width = frame.size.width > 0 ? frame.size.width : SCREEN_WIDTH;
        [self configUI];
    }
    return self;
}

- (void)configUI{
    [self addSubview:self.viewContent];
    [self.viewContent addSubview:self.labelContent];
}

- (void)resetVerifyBankCardIsShowTips:(BOOL)isShowTips{
    self.labelContent.leftTop = XY(LEFT_MARDIN, Ratio(12));
    self.labelContent.hidden = !isShowTips;
    self.viewContent.height = isShowTips ? self.labelContent.bottom+Ratio(20) : Ratio(20);
    self.viewContent.centerXTop = XY(self.width/2, 0);
    
    UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.viewContent.bounds byRoundingCorners:(UIRectCornerBottomLeft | UIRectCornerBottomRight) cornerRadii:CGSizeMake(16, 16)];
    CAShapeLayer *maskLayer = [CAShapeLayer layer];
    maskLayer.path = path.CGPath;
    self.viewContent.layer.mask = maskLayer;
    self.height = self.viewContent.bottom;
}

@end
